package com.simple.microservices.manager;

import com.simple.microservices.api.auth.AuthService;
import com.simple.microservices.api.dto.LoginDTO;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 *
 */
@Component
public class AuthManager {

    @Resource
    private AuthService authService;
    /**
     * 登录
     * @param loginDTO
     * @param request
     * @param response
     */
    public void login(LoginDTO loginDTO, HttpServletRequest request, HttpServletResponse response) {
        String token = authService.login(loginDTO);
        response.addHeader("token", token);
    }
}
